
@extends('admin.base.index')

@section('tables')      
<form action="" method="post" name="myform">
    <input type="hidden" name="_token" value="{{ csrf_token() }}">
    <input type="hidden" name="_method" value="delete">
</form>     
<div class="row">
<div class="col-sm-12">
    <section class="panel">
        <header class="panel-heading">
            轮播列表
                <span class="tools pull-right">
                    <a href="/admin/carousel/create">添加轮播</a>
                </span>
        </header>
        
        <div class="panel-body">
            <table class="table">
            
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>地址</th>
                        <th>图片</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach($carousels as $v)
                <tr>
                    <td>{{ $v->id }}</td>
                    <td>{{ $v->address }}</td>
                    <td><img src="{{$v->profile}}" width="200" height='100' alt=""></td>
                    <td>
                        <a href="javascript:doDel({{ $v->id }})">删除</a>|
                        <a href="/admin/carousel/{{ $v->id }}/edit">修改</a>|
                    </td> 
                </tr>
                @endforeach
                </tbody>
            </table>
             <script type="text/javascript">
                 function doDel(id)
                 {
                    if(confirm('确定要删除吗？')){
                         var form = document.myform;
                        form.action = '/admin/carousel/'+id;
                        form.submit();
                    }
                }
            </script>
           {{ $carousels->links() }}
        </div>
    </section>
</div>
@endsection